﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DS_Server
{
    public class Person
    {
        public int id;
        public string FName;
        public string LName;
        public int Age;

        public Person()
        {
        }

        public Person(int id, string fname, string lname, int age)
        {
            this.id = id;
            this.FName = fname;
            this.LName = lname;
            this.Age = age;
        }

        public string SaveToDB()
        {
            string str = "Person:" + id.ToString() + ":" + FName.ToString() + ":"
                + LName.ToString() + ":" + Age.ToString();

            return str;
        }

        public string SaveToSCV()
        {
            string str = "Person;" + id.ToString() + ";" + FName.ToString() + ";"
                + LName.ToString() + ";" + Age.ToString() + ";";

            return str;
        }
        public void LoadFromDB(object[] Arr)
        {
            id = Convert.ToInt32(Arr[0]);
            FName = Arr[1].ToString();
            LName = Arr[2].ToString();
            Age = Convert.ToInt32(Arr[3]);
        }
        public void LoadFromCSV(string[] strArray)
        {
            id = Convert.ToInt32(strArray[1]);
            FName = strArray[2];
            LName = strArray[3];
            Age = Convert.ToInt32(strArray[4]);
        }
    }
}
